package com.example.demo.http;

import com.example.demo.commons.Commons;
import lombok.Data;

@Data
public class Result<T> {
    int state;
    String msg;
    T data;


    public Result(int state, String msg, T data) {
        this.state = state;
        this.msg = msg;
        this.data = data;
    }


    public static <T> Result<T> createSuccesful(T data){
        return new Result<>(Commons.NET_SUCCESS,"",data);
    }

    public static <T> Result<T> createError(int state,String msg){
        return new Result<>(state,msg,null);
    }
}

